#pragma once
#include <QWidget>
#include<string>
#include<vector>
#include<mysql.h>
#include<fstream>
#include<opencv2/opencv.hpp>

using namespace std;

class util
{	
	public:
		void PromptBox(QWidget * parent, const char title[], const char text[], const char button1[], const char button2[]);
		string GetDate();
		string GetBoard(string filName);
		string DateChange(int t);
		string CreateDetectFile(string fileName);
		string CreateDateFile(string fileName);
		int getFileNum(string fileName);
		void getFileName(vector<string> &v, string fileName);
		string CreateBoardFile(string fileName);
		bool CreateCameraFile(string fileName);
		string getDetectFile();
		int getImgPosition(int curCamrea, int curIndex);
		int getMax(int a, int b);
		int getMin(int a, int b);
		bool judgeDistance(int d, int l1, int r1, int l2, int r2);
		bool* initBArry(int length, bool b);
		int** initITwoArry(cv::Mat stats, int nccomps);
		void write(string fileName, cv::Mat src);
		bool fileExist(char* filename);
		string readTXT(string filename);
		void writeSizeTXT(string filename,int imgnum, int index, int x, int y, int width, int height);
		void writeDSizeTXT(string filename,int num, double imgnum1, double imgnum2, double imgnum, double index, double x, double y, double width, double height,double w,double z);
		double getQJRank(int num);
		//void getJJRank(BBoard &bboard, int cCamera, int imageNum, int JJNum);
		//void JJRtoN(BBoard &bboard);
		//void getRank(vector<double> &v1);
		//void intToCharArray(char* &cArray, int num);
		//void testbatch();
		//void testbatch2();
		//void sqllistToArray(QString qsl,  vector<vector<string>> &v);
		//void ArrayTosqllist(string &list, int select);
		//void CArrayTosqllist(QStringList &list);
		//void intToCharArray(char* &cArray, int num);
		void split(const string& s, vector<string>& tokens, char delim);
};
